<?php
if(!defined('IN_KKFRAME')) exit();

$fid = intval($_GET['fid']);
if(!$_K['config']['forums'][$fid]) showmessage('指定的分类不存在！', referer());
$amount = DB::result_first("SELECT COUNT(*) FROM thread WHERE fid='{$fid}'");
$max_page = ceil($amount / 10);
$page = max(1, min(intval($_GET['page']), $max_page));
$limit = 10*($page - 1);
$threadlist = array();
$threadlist = DB::fetch_all("SELECT * FROM thread WHERE fid='{$fid}' ORDER BY lastpost DESC LIMIT {$limit},10");

$nav = array($_K['config']['forums'][$fid] => 'forum.php?fid='.$fid);

include template('forum');